package com.sincon.web.controller.bilibili;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ConcurrentHashMap;

@RestController
public class AcmeController {
    
    private static final ConcurrentHashMap<String, String> CHALLENGE_RESPONSES = new ConcurrentHashMap<>();
    
    @GetMapping("/.well-known/acme-challenge/{token}")
    public String handleChallenge(@PathVariable String token) {
        return CHALLENGE_RESPONSES.get(token);
    }
    
    public static void addChallengeResponse(String token, String authorization) {
        CHALLENGE_RESPONSES.put(token, authorization);
    }
} 